#ifndef _CAMERA_H_
#define _CAMERA_H_

#include "zf_common_headfile.h"
#include <math.h>

typedef struct
{
    int8 en_out;
    int8 en_destination;
    int8 en_in;
    int8 flag;
    int8 mode;//����ģʽ��0Ϊ������ 1Ϊ��߳��� 2Ϊ�ұ߳���
    int8 flag_out;
    int error_out;
    int error_in;
    int16 encoder;
    float roll;
    int destination_count;
} Garage_Class;

typedef struct
{
    uint16  straight_encoder;
    uint16  straight_max;
    int error_update;
    int error_max;
    int x;
    uint8 size;
    uint8 close;
} Ring_Class;

typedef struct
{
    int8 right_count;
    int8 right_en;
    int8 left_count;
    int8 left_en;
    int error;
    int32 encoder;
    int8 left_right;
} ForkRoad_Class;

extern Garage_Class garage;

extern Ring_Class ring;

extern ForkRoad_Class forkroad;

extern int all_out_right[24];
extern int all_out_scan_mid[24];
void sendCamImgToCamViewer(void);//����һ��ͼ��freeCar��λ��

void Six_line(void);
void line_Init(void);
void First_LineFind(void);
void Up_LineFind (void);
void Camera_Get_Value(void);

void R_big(void);
void L_big(void);
void Cross_Contrl(void);
int linear(int x1,int y1,int x2,int y2,int y);
void Second_LineFind(void);
void Threshold_value(void);
void Garage_Out(void);
void Garage_Out_Z(void);
void Garage_Out_Y(void);
void Garage_offset(void);
void Ring_offset(void);
/* 19�쾵ͷ��Բ�� */
extern int Ring_left[60];
extern int Ring_right[60];
void new_Ring_Line_init();
void new_Ring_LineFind();
void new_Ring_offset(void);
extern uint8 zhizou_jilu;
extern uint8 zhizou_zuobian;//ֱ��ʱ���15�к����ҵ��߼�¼
extern int edge_Width[6];
/* 19�쾵ͷ��Բ�� */
_Bool Line_down(void);
void Line_acceleration(void);
void Big_Ramp(void);
void Small_Ramp(void);
void ForkRoad_Z(void);
void ForkRoad_Y(void);

float Pid_Control_Speed_Z(float speed);
float Pid_Control_Speed_Y(float speed);
void Destination_Z(void);
void Destination_Y(void);
void Destination_LineFind_Y(void);
void Destination_LineFind_Z(void);
void AddSpeedCrazy(void);
void straight_line(void);
float slope_k1(int x1,int y1,int x2,int y2);//��б��

void zhanai(void);//�ϰ�
void zhian_saox_z(void);
void zhian_saox_y(void);
void duanlu(void);//��·
void podao(void);//�µ�
void Garage_Out_Y(void);
void Garage_Out_Z(void);
void chuku(void);
void yuansujis(void);//����·
void  yuansujis_count(void);
//void find_out(void);

void First_LineFind11 (void);
#endif
